﻿Imports System.Windows.Forms
Imports System.Threading
Imports Wys.Control.Vb
Imports System.Diagnostics

Module Module1
    Public Sub Main()
        Try
            Application.EnableVisualStyles()
            Application.SetCompatibleTextRenderingDefault(False)

            '初始化资源
            Wys.Control.Vb.AutoAdjustFrom.InitSpool()
            Dim strName As String = "wangys"
            Dim itype As Integer = 0
         
            AddHandler Application.ThreadException, AddressOf Form1_UIThreadException
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException)

            AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf CurrentDomain_UnhandledException

            Dim frm As Wys.Control.Vb.AutoAdjustFrom
            Dim applicationType As String = ResouceSpool.cConfig.GetAppSettings("ApplicationType")
            If applicationType = "0" Then
                frm = New MainSecond3
            ElseIf applicationType = "1" Then
                frm = New MainSecond3
            ElseIf applicationType = "2" Then
                frm = New MainSecond3
            Else
                frm = New MainSecond3
            End If
            frm.strName = strName
            frm.iType = itype
            Application.Run(frm)
        Catch ex As Exception
            EventLog.WriteEntry("永胜数据库系统", ex.ToString, EventLogEntryType.Error)
        End Try
       
    End Sub

    Private Sub Form1_UIThreadException(ByVal sender As Object, ByVal t As ThreadExceptionEventArgs)
        UTIL.CException.SaveExcepiton(UTIL.ErrorType.Error, t.Exception)
    End Sub

    Private Sub CurrentDomain_UnhandledException(ByVal sender As Object, _
        ByVal t As UnhandledExceptionEventArgs)
        UTIL.CException.SaveExcepiton(UTIL.ErrorType.Error, CType(t.ExceptionObject, Exception))
    End Sub

End Module
